Repository navigation
MCP server: an HTTP mode for Home Assistant - #352
vpatel9202 wants to merge 6 commits into
Conversation
Same tools on a second FastMCP on 127.0.0.1, with a tv_ prefix, no screenshot or uninstall, power off only when allowed, and a tool that takes over 24 s answers pending and finishes in the background (Home Assistant gives a tool 30 s). The instructions and docstrings no longer name a room or a city. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…child, wait parsed only in HTTP, docs say 127.0.0.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e it Couch TV, stateless Home Assistant's client drops a response stream that is silent for 5 s, so a slow tool (tv_play, about 15 s) looked like an error. A log line now goes down the request's own stream every 2 s. Stateless, because Home Assistant opens a new session for every call: no session to close, so no standalone SSE writer traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, this is really tidy work. Stdio mode is unchanged, the Host and Origin checks held up, and the tests pass. Two things to fix before it can go in:
Hold off on big changes until there's an answer on the wider question in #351, but these two are worth fixing either way. |
… raw name for off: KEYCODE_POWER, KEY_POWER, PowerOff, power_toggle), tv_launch takes no links Review on Seagey#352. Raw key names still work with COUCH_MCP_ALLOW_POWER_OFF=1, and stdio mode is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p keys through, raw key names stay refused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…OW_SETTINGS=1 (the settings, bluetooth and network ids, each kind of TV's settings app, the settings key) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for catching both. Fixed and pushed:
Honestly, it's a speed bump, not a wall. With arrow keys and OK, a model that tries hard can still reach Settings from the home screen, and nothing short of removing navigation stops that. What it stops is a misheard "open settings" and the quick way in, which is the realistic risk with a voice assistant. For the buttons that do the damage, I opened #360 separately: |
Part of #351 (1 of 3 for the Home Assistant app). Independent of the other PRs.
COUCH_MCP_HTTP=1runsbridge/mcp_server.pyas Streamable HTTP on127.0.0.1(portCOUCH_MCP_PORT, default 5401) for Home Assistant's MCP integration. Without it, stdio mode is unchanged: same tool names, same behaviour for/api/ask.tv_prefix, noscreenshot(results reach the model as JSON text) oruninstall_app. Power off (tv_power, thepowerandsleepkeys,off_after_episode) is refused unlessCOUCH_MCP_ALLOW_POWER_OFF=1. Read-only tools carryreadOnlyHint.pendingafterCOUCH_MCP_WAIT(24 s) while the work finishes in the background.tests/test_mcp_http.py(11), including a client with a 5 s read timeout against an 8 s tool.docs/AI-AGENT.md.Tested against Home Assistant Core 2026.11.3 (its MCP client is mcp 2.3.0), and through Home Assistant's own client library: a 20 s
tv_playanswers, and apendingcomes back past the wait.🤖 Generated with Claude Code